package com.example.user.myzzyl_android;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.facebook.drawee.view.SimpleDraweeView;

import java.util.List;

/**
 * Created by User on 2017/7/21.
 */

public class XianLuAdpter extends BaseAdapter{
    Context context;
    List<String> data;
    List<String> text;

    public XianLuAdpter(Context context, List<String> data, List<String> text) {
        this.context = context;
        this.data = data;
        this.text = text;
    }

    @Override
    public int getCount() {
        return text.size();
    }

    @Override
    public Object getItem(int i) {
        return null;
    }

    @Override
    public long getItemId(int i) {
        return i;
    }
    LocalImageHolderView localImageHolderView;
    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        if (view==null){
            localImageHolderView = new LocalImageHolderView();
            view = View.inflate(context,R.layout.imageitem2,null);
            localImageHolderView.imageView = view.findViewById(R.id.SimpleDraweeView2);
            localImageHolderView.textView = view.findViewById(R.id.text);
            view.setTag(localImageHolderView);
        }else {
            localImageHolderView = (LocalImageHolderView) view.getTag();
        }
            localImageHolderView.imageView.setImageURI(data.get(i));
            localImageHolderView.textView.setText(text.get(i));
        return view;
    }
    private class LocalImageHolderView{
        TextView textView;
        SimpleDraweeView imageView;
    }
}
